﻿<%@ Page Title="Flight Plans" Language="C#" Culture="auto" UICulture="auto" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Plans.aspx.cs" Inherits="IFD2.Plans" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <link href="Datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>

    <form id="form1" runat="server" role="form" class="form-inline" defaultbutton="lbtnQuery">
    <div class="container-fluid body-content" style="width:100%;">

    <div class="row">
        <div class="col-sm-2 well well-sm">
            <h5><asp:Literal ID="litTitle" runat="server" meta:resourcekey="tipPageTitle"></asp:Literal></h5>
            <div class="form-group">
                <asp:Label ID="Label1" runat="server" Text="Flight:" meta:resourcekey="Flight"></asp:Label>
                <asp:Label ID="lblAirline" runat="server" Text=""></asp:Label>
                <asp:TextBox ID="txtFltNo" runat="server" CssClass="form-control input-sm" Width="100%" MaxLength=6></asp:TextBox>
                <asp:Label ID="Label3" runat="server" Text="Status:" meta:resourcekey="Status"></asp:Label><br />
                <asp:DropDownList ID="lstPlanStatus" runat="server" CssClass="form-control input-sm" style="width:100%">
                    <asp:ListItem Selected="True" Value="E" meta:resourcekey="Editing">E-Editing</asp:ListItem>
                    <asp:ListItem Value="S" meta:resourcekey="Submitted">S-Submitted</asp:ListItem>
                    <asp:ListItem Value="A" meta:resourcekey="Approved">A-Approved</asp:ListItem>
                    <asp:ListItem Value="P" meta:resourcekey="Published">P-Published</asp:ListItem>
                </asp:DropDownList>
            </div>
            <br class="hidden-xs"/><br class="hidden-xs"/>
            <asp:LinkButton ID="lbtnQuery" runat="server" CssClass="form-control input-sm btn-primary text-center" Width="100%" ToolTip="" meta:resourcekey="tipQuery" OnClick="lbtnQuery_Click"> <span class="glyphicon glyphicon-search" style="font-size:large;"></span></asp:LinkButton>
            <p></p><%--没有此行(或&nbsp;)，上面的按钮在手机模式(xs)下，只有上半部可以点击！--%>
        </div>

        <div class="col-sm-10 well well-sm">
            <div class="panel">
                <div class="panel-heading btn-primary">
                    <h6 class="panel-title" id="section-2"><asp:Literal ID="Literal1" runat="server" meta:resourcekey="tipPageTitle2"></asp:Literal></h6>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="airline,flt_no,id" 
                            DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" style="min-width:1200px;width:100%;" class="table-hover">
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:TemplateField HeaderText=" ">
                                    <ItemTemplate>
                                        <input name="KEY" type="radio" value='<%# Eval("airline")+"|"+Eval("flt_no")+"|"+Eval("id") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Flight" meta:resourcekey="Flight1">
                                    <ItemTemplate>
                                        <%# Eval("airline")%> <%#Eval("flt_no")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id"  meta:resourcekey="id1" />
                                <asp:BoundField DataField="plan_status" HeaderText="plan_status" SortExpression="plan_status"  meta:resourcekey="plan_status" Visible="false" />
                                <asp:BoundField DataField="week_mask" HeaderText="week_mask" SortExpression="week_mask"  meta:resourcekey="week_mask" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="week_interval" HeaderText="week_interval" SortExpression="week_interval"  meta:resourcekey="week_interval" ItemStyle-HorizontalAlign="Center" />
                                <%--<asp:BoundField DataField="flt_type" HeaderText="flt_type" SortExpression="flt_type"  meta:resourcekey="flt_type" ItemStyle-HorizontalAlign="Center" />--%>
                                <asp:BoundField DataField="surcharge_type" HeaderText="surcharge_type" SortExpression="surcharge_type"  meta:resourcekey="surcharge_type" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="date_from" HeaderText="date_from" SortExpression="date_from"  meta:resourcekey="date_from" DataFormatString="{0:d}" />
                                <asp:BoundField DataField="date_to" HeaderText="date_to" SortExpression="date_to"  meta:resourcekey="date_to" DataFormatString="{0:d}" />
                                <asp:BoundField DataField="dep_time_nature" HeaderText="dep_time_nature" SortExpression="dep_time_nature"  meta:resourcekey="dep_time_nature" DataFormatString="{0:t}" />
                                <asp:BoundField DataField="initial_status" HeaderText="initial_status" SortExpression="initial_status"  meta:resourcekey="initial_status" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="tail_no" HeaderText="tail_no" SortExpression="tail_no"  meta:resourcekey="tail_no" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="ac_type" HeaderText="ac_type" SortExpression="ac_type"  meta:resourcekey="ac_type" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="done_user" HeaderText="done_user" SortExpression="done_user"  meta:resourcekey="done_user" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="done_time" HeaderText="done_time" SortExpression="done_time"  meta:resourcekey="done_time" ItemStyle-HorizontalAlign="Center" />
                            </Columns>
                            <RowStyle BackColor="#EFF3FB" />
                            <EditRowStyle BackColor="#2461BF" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                    </div>
                    <div class="btn-group">
                        <asp:Button ID="btnRoute" runat="server" CssClass="btn btn-sm btn-default" Text="Route..." meta:resourcekey="Route" onclick="btnRoute_Click" />
                        <asp:Button ID="btnSeatCtl" runat="server" CssClass="btn btn-sm btn-default" Text="Seat Ctl..." OnClick="btnSeatCtl_Click"  meta:resourcekey="SeatCtl" />
                        <asp:Button ID="btnVirtualFlts" runat="server" CssClass="btn btn-sm btn-default" Text="Virtual..." PostBackUrl="PlanVirtual.aspx" meta:resourcekey="virtual" />
                        <asp:Button ID="btnSeatMap" runat="server" CssClass="btn btn-sm btn-default" Text="Seat Map..." meta:resourcekey="SeatMap" onclick="btnSeatMap_Click" />
                        <%--<asp:Button ID="btnSegments" runat="server" CssClass="btn btn-sm btn-default" Text="Segments...X" OnClick="btnSegments_Click" Visible="false" meta:resourcekey="Segments" Enabled="False" />--%>
                        <asp:Button ID="btnLog" runat="server" Text="Logs..."  OnClick="btnLog_Click"  CssClass="btn btn-sm btn-default" meta:resourcekey="Logs" />
                    </div><br />
                    <div class="btn-group">
                        <asp:Button ID="btnDelete" runat="server" CssClass="btn btn-sm btn-default" Text="Delete" OnClick="btnDelete_Click" meta:resourcekey="Delete" />
                        <asp:Button ID="btnSubmit" runat="server" CssClass="btn btn-sm btn-default" Text="Submit" OnClick="btnSubmit_Click" meta:resourcekey="Submit" />
                        <asp:Button ID="btnApprove" runat="server" CssClass="btn btn-sm btn-default" Text="Approve" OnClick="btnApprove_Click" meta:resourcekey="Approve" />
                        <asp:Button ID="btnReject" runat="server" CssClass="btn btn-sm btn-default" OnClick="btnReject_Click" Text="Reject" meta:resourcekey="Reject" />
                    </div>
                    <div class="form-group">
                        <asp:CheckBox ID="chkDepInit" runat="server" Text="Initiate Seat Map Immediately" meta:resourcekey="InitiateSeatMap" />
                        <asp:Button ID="btnPublish" runat="server" CssClass="btn btn-sm btn-default" Text="Publish" OnClick="btnPublish_Click"  meta:resourcekey="Publish" ForeColor="Red" />
                    </div>
                    <br />
                    <asp:Label ID="lblError" runat="server" CssClass="ifdMessage"></asp:Label>
                </div>

                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>" SelectCommand="bll_plan_get_by_flt_no_status" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                        <SelectParameters>
                            <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                            <asp:ControlParameter ControlID="txtFltNo" Name="flt_no" PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="lstPlanStatus" Name="status" PropertyName="SelectedValue" Type="String" />
                        </SelectParameters>
                </asp:SqlDataSource>
            </div>

            <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
            <asp:View ID="View1" runat="server">
            <div class="panel">
                <div class="panel-heading btn-primary">
                    <h6 class="panel-title" id="section-3"><asp:Literal ID="Literal2" runat="server" meta:resourcekey="AddNewPlan"></asp:Literal></h6>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                    <asp:Label ID="Label4" runat="server" Text="Flight:" meta:resourcekey="Flight"></asp:Label>
                    <asp:TextBox ID="txtFltNo2" MaxLength="6" runat="server" Width="73px"></asp:TextBox>
                    </div>
                    <div class="form-group">
                    <asp:Label ID="Label2" runat="server" Text="ID:" meta:resourcekey="ID"></asp:Label>
                    <asp:TextBox ID="txtPlanId" runat="server" Width="114px" MaxLength="16"></asp:TextBox>
                    </div>
                   <%-- <div class="form-group">
                    <asp:Label ID="Label10" runat="server" meta:resourcekey="FltType" Text="Flt Type:"></asp:Label>
                    <asp:DropDownList ID="lstFltType" runat="server">
                        <asp:ListItem>1</asp:ListItem>
                        <asp:ListItem>2</asp:ListItem>
                        <asp:ListItem Selected="True">3</asp:ListItem>
                        <asp:ListItem>4</asp:ListItem>
                        <asp:ListItem>5</asp:ListItem>
                    </asp:DropDownList>
                    </div>--%>
                    <div class="form-group">
                    <asp:Label ID="Label7" runat="server" meta:resourcekey="InitialStatus" Text="Initial Status:"></asp:Label>
                    <asp:DropDownList ID="lstStatus" runat="server">
                        <asp:ListItem Selected="True" Value="O" meta:resourcekey="Open">Open</asp:ListItem>
                        <asp:ListItem Value="L" meta:resourcekey="Locked">Locked</asp:ListItem>
                    </asp:DropDownList>
                    </div><br class="hidden-xs" />
                    <div class="form-group">
                    <asp:Label ID="Label20" runat="server" meta:resourcekey="Week" Text="Week:"></asp:Label>
                    <asp:CheckBox ID="chkWeek1" runat="server" Checked="True" meta:resourcekey="Monday" Text="Monday" />
                    <asp:CheckBox ID="chkWeek2" runat="server" Checked="True" meta:resourcekey="Tuesday" Text="Tuesday" />
                    <asp:CheckBox ID="chkWeek3" runat="server" Checked="True" meta:resourcekey="Wednesday" Text="Wednesday" />
                    <asp:CheckBox ID="chkWeek4" runat="server" Checked="True" meta:resourcekey="Thursday" Text="Thursday" />
                    <asp:CheckBox ID="chkWeek5" runat="server" Checked="True" meta:resourcekey="Friday" Text="Friday" />
                    <asp:CheckBox ID="chkWeek6" runat="server" Checked="True" Font-Bold="True" meta:resourcekey="Saturday" Text="Saturday" />
                    <asp:CheckBox ID="chkWeek7" runat="server" Checked="True" Font-Bold="True" meta:resourcekey="Sunday" Text="Sunday" ForeColor="Red" />
                    </div>
                    <div class="form-group">
                    <asp:Label ID="Label21" runat="server" meta:resourcekey="WeekInterval" Text="Week Interval:"></asp:Label>
                    <asp:DropDownList ID="lstWeekInterval" runat="server">
                        <asp:ListItem Selected="True" Value="0">0</asp:ListItem>
                        <asp:ListItem Value="1">1</asp:ListItem>
                        <asp:ListItem Value="2">2</asp:ListItem>
                    </asp:DropDownList>
                    </div><br class="hidden-xs" />
                    <div class="form-group">
                    <asp:Label ID="Label6" runat="server" meta:resourcekey="Date" Text="Date:"></asp:Label>
                    <asp:TextBox ID="txtDateFrom" CssClass="form_date" runat="server" Width="94px" MaxLength="10"></asp:TextBox>-
                    <asp:TextBox ID="txtDateTo" CssClass="form_date" runat="server" Width="94px" MaxLength="10"></asp:TextBox>
                    </div>
                    <div class="form-group">
                    <asp:Label ID="Label22" runat="server" Text="Departure Time(Nature):" meta:resourcekey="NatureDepartureTime"></asp:Label>
                    <asp:TextBox ID="txtDepTime" CssClass="form_time" runat="server" MaxLength="5" Width="41px"></asp:TextBox>(hh:mm)
                    </div><br class="hidden-xs" />
                    <div class="form-group">
                    <asp:Label ID="Label9" runat="server" Text="Aircraft:" meta:resourcekey="Aircraft"></asp:Label>
                    <asp:DropDownList ID="lstTailNo" runat="server" DataSourceID="SqlDataSource2" 
                        DataTextField="tail_no" DataValueField="tail_no">
                    </asp:DropDownList>
                    </div>
                    <div class="form-group">
                    <asp:Label ID="Label12" runat="server" Text="Surcharge Type: " meta:resourcekey="SurchargeType"></asp:Label>
                    <asp:DropDownList ID="lstSurchargeType" runat="server">
                        <asp:ListItem>1</asp:ListItem>
                        <asp:ListItem>2</asp:ListItem>
                        <asp:ListItem>3</asp:ListItem>
                        <asp:ListItem>4</asp:ListItem>
                        <asp:ListItem Selected="True">5</asp:ListItem>
                        <asp:ListItem>6</asp:ListItem>
                        <asp:ListItem>7</asp:ListItem>
                        <asp:ListItem>8</asp:ListItem>
                        <asp:ListItem>9</asp:ListItem>
                    </asp:DropDownList>
                    </div>
                    <%--<div class="form-group">
                    <asp:Label ID="Label5" runat="server" Enabled="False" ForeColor="Red" meta:resourcekey="ValidDate" Text="Valid Date: _X" Visible="False"></asp:Label>
                    <asp:TextBox ID="txtValidDate" runat="server" Width="81px" Enabled="False" Visible="False"></asp:TextBox><br /><br />
                    </div>--%>
                    <asp:Button ID="btnAdd" runat="server" CssClass="btn btn-sm btn-default" Text="Add New Plan" OnClick="btnAdd_Click" meta:resourcekey="AddNewPlan" />
                </div>
            </div>

            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                SelectCommand="bll_aircraft_get_tail_nos" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                <SelectParameters>
                    <asp:SessionParameter Name="airline" SessionField="AIRLINE" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            </asp:View></asp:MultiView>
        </div>
    </div>

    </div></form>

    <script src="Datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script src="JS/ScrollableGridPlugin.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            //$('.form_datetime').datetimepicker({
            //    format: 'yyyy-m-d hh:ii',
            //    weekStart: 1,
            //    todayBtn: 1,
            //    autoclose: 1,
            //    todayHighlight: 1,
            //    startView: 'month',
            //    forceParse: 0,
            //    showMeridian: 0
            //});
            $('.form_date').datetimepicker({
                format: 'yyyy-m-d',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 'month',
                minView: 'month',
                forceParse: 0
            });
            $('.form_time').datetimepicker({
                format: 'hh:ii',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 'day',
                minView: 'hour',
                maxView: 'day',
                forceParse: 0
            });

            var win_height = parseInt($(window).height());
            var tab_new_height= win_height-50-100;//菜单占50， 为便于操作留空100
            if ($('#<%=GridView1.ClientID %>').height()>tab_new_height)
                $('#<%=GridView1.ClientID %>').Scrollable({ ScrollHeight: tab_new_height });
        });
    </script>

</asp:Content>
